#lang racket


(require "../base/main.rkt")

(require "domain.rkt"
         "curve.rkt"
         "circle-curve.rkt")

(provide (struct-out donut-curve)
         donut-curve-object
         donut-curve-tangent
         donut-curve-normal
         donut-curve-binormal
         make-donut-curve)


(define-struct (donut-curve curve)
  (inner-radius outer-radius)
  #:constructor-name new-donut-curve)

(define (donut-curve-object inner-radius outer-radius)
  (λ (t)
    (list
     ((circle-curve-object inner-radius) t)
     ((circle-curve-object outer-radius) t))))

(define (donut-curve-tangent inner-radius outer-radius)
  (λ (t)
    (list
     ((circle-curve-tangent inner-radius) t)
     ((circle-curve-tangent outer-radius) t))))

(define (donut-curve-normal inner-radius outer-radius)
  (λ (t)
    (list
     ((circle-curve-normal inner-radius) t)
     ((circle-curve-normal outer-radius) t))))

(define (donut-curve-binormal inner-radius outer-radius)
  (λ (t)
    (list
     ((circle-curve-binormal inner-radius) t)
     ((circle-curve-binormal outer-radius) t))))

(define (make-donut-curve inner-radius outer-radius)
  (new-donut-curve
   (donut-curve-object inner-radius outer-radius)
   (donut-curve-tangent inner-radius outer-radius)
   (donut-curve-normal inner-radius outer-radius)
   (donut-curve-binormal inner-radius outer-radius)
   (make-domain 'closed 0 'open 2pi)
   inner-radius
   outer-radius))